package com.cyp.gatewayservice.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.route.Route;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RequestMapping("/api/gatewayservice")
@RestController
public class GateWayController {

    @GetMapping("/hello")
    public String sayHello(){

        return "gatewayservice";
    }
    @Autowired
    private RouteLocator routeLocator;

    @GetMapping("/routes")
    public Flux<Route> routes() {
        return routeLocator.getRoutes();
    }

}
